package com.facebook.lastproject.base;

import com.facebook.lastproject.contract.IModel;
import com.facebook.lastproject.contract.IPresenter;
import com.facebook.lastproject.contract.IView;

/**
 * 类名: BasePresenter
 * 此类用途: ---
 *
 * @Author: peixi
 * @Date: 2018-03-12 16:03
 * @Email: cr7inmanchester.com
 * @FileName: com.facebook.lastproject.base.BasePresenter.java
 */
public class BasePresenter<M extends IModel, V extends IView> implements IPresenter {
    protected M mModel;
    protected V mRootView;

    /**
     * 如果当前页面同时需要 Model 层和 View 层,则使用此构造函数(默认)
     *
     * @param model
     * @param rootView
     */
    public BasePresenter(M model, V rootView) {
//        Preconditions.checkNotNull(model, "%s cannot be null", IModel.class.getName());
//        Preconditions.checkNotNull(rootView, "%s cannot be null", IView.class.getName());
        this.mModel = model;
        this.mRootView = rootView;
        onStart();
    }

    /**
     * 如果当前页面不需要操作数据,只需要 View 层,则使用此构造函数
     *
     * @param rootView
     */
    public BasePresenter(V rootView) {
//        Preconditions.checkNotNull(rootView, "%s cannot be null", IView.class.getName());
        this.mRootView = rootView;
        onStart();
    }

    public BasePresenter() {
        onStart();
    }

    @Override
    public void onStart() {

    }

    @Override
    public void onDestroy() {

    }
}
